﻿@model QsdRenderModel
@{
    var QSDs = Model.AllSubItems;
    var pqsdid = Model.ParentID;
    var deep = Model.CurrentDeepLvl;
    
    var exts = (string[])TempData["FileExts"];//        var extx = new string[] { ".png", ".jpg", ".jpeg", ".gif" };
    var PreviewOnly = (bool)TempData["PreviewOnly"];    //ViewBag.ForceEdit != true && "True".Equals(Request["PreviewOnly"], StringComparison.CurrentCultureIgnoreCase);

    if (deep > 12) { return; }
}
<ul class="qizdetails quizlv@(deep)" id="quizsd_@(pqsdid)" >
    @foreach (var QsdItem in QSDs)
    {
        try
        {
            int index = (int)TempData["QuizIndex"];
            var typeval = QsdItem.QizSubjectDefine.QizItem.TypeRef.OptionValue;
            var QsdItemId = "QSD." + QsdItem.ID;

            var IsRawTypeVal = (typeval == "7");
            var partialmodel= new QsdRenderModel() { 
                AllSubItems=Model.AllSubItems, 
                ParentID=QsdItemId, 
                CurrentItem=QsdItem,
                CurrentDeepLvl=deep+1};
            
            if (IsRawTypeVal)
            {
                @Html.Partial("QsdRenders/TypeOf_" + typeval, partialmodel);
            }
            else
            {
                var IsQsdWarrning = QsdItem.ValueAutoEvaluation == "异常";
        <li class="quiz-item-body @(QsdItem.QizSubjectDefine.QizItem.RequiredItem ? "not-null" : "")">
            <span class="quiz-idx quizlv@(deep)" style="@(IsQsdWarrning ? "color:red" : "")">
                @(QsdItem.QizSubjectDefine.QizItem.RequiredItem ? "*" : " ")@(index). </span>
            @{TempData["QuizIndex"] = ++index;}
            <span style="@(IsQsdWarrning ? "color:red;" : "color:black;")">
                @Html.DisplayFor(model => QsdItem.QizSubjectDefine.QizItem.Title)
            </span>
            @Html.Partial("QsdRenders/TypeOf_" + typeval,partialmodel)
        </li>
            }
        }
        catch (Exception ex)
        {
        <li class="error">!ERROR When process Item #@QsdItem.ID
            <span style="display: none">
                @QsdItem.UserValue
                <br />
                @ex.Message
            </span></li>
        }
    }
</ul>